<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <img :src="imgArr[index]" alt="">
        <a href="javaScript:;" v-show="index!=0" @click="prev">上一张</a>
        <a href="javaScript:;" v-show="index<imgArr.length-1" @click="next">下一张</a>
    </div>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                imgArr: ["阿狸.jpg", "哆啦A梦.jpg", "皮卡丘.jpg"],
                index: 0
            },
            methods: {
                prev: function () {
                    this.index--;
                },
                next: function () {
                    this.index++;
                }
            }
        })
    </script>
</body>

</html>